﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Carrousel.Model;
using System.Windows.Data;
using CarrouselPanel;

namespace Carrousel.Converters
{
    public partial class ConfigPanel : UserControl
    {
        public ConfigPanel()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(ConfigPanel_Loaded);
        }

        void ConfigPanel_Loaded(object sender, RoutedEventArgs e)
        {
            this.DataContext = CarrouselModel.Instance;

            Binding bindcircleWidth = new Binding("circleWidth");
            bindcircleWidth.Mode = BindingMode.TwoWay;
            xSliderWidth.SetBinding(Slider.ValueProperty, bindcircleWidth);
            Binding bindcircleHeight = new Binding("circleHeight");
            bindcircleHeight.Mode = BindingMode.TwoWay;
            xSliderHeight.SetBinding(Slider.ValueProperty, bindcircleHeight);
        }

        private void xCheckBoxAuto_Click(object sender, RoutedEventArgs e)
        {
            if (Convert.ToBoolean(xCheckBoxAuto.IsChecked))
            {
                CarrouselModel.Instance.autoPlay = true;
            }
            else
            {
                CarrouselModel.Instance.autoPlay = false;
            }
        }

        private void rbLeft_Click(object sender, RoutedEventArgs e)
        {
            CarrouselModel.Instance.distance = Distance.Left;
        }

        private void rbRight_Click(object sender, RoutedEventArgs e)
        {
            CarrouselModel.Instance.distance = Distance.Right;
        }
    }
}
